package com.ywu.application.standard.configCenter.api;

import com.ywu.common.result.CommonResult;
import com.ywu.application.standard.configCenter.dto.ConfigCenterDto;
import com.ywu.application.standard.configCenter.service.ConfigCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName ConfigCenterApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/3/2 12:39
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/config/center")
public class ConfigCenterApi {
    @Autowired
    private ConfigCenterService configCenterService;

    /**
    * @Author GroundDemo
    * @Description 查询配置中心分页信息
    * @Date 18:12 2024/3/2
    * @Param [configCenterDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/config.info")
    public CommonResult<Object> getConfigInfo(@RequestBody ConfigCenterDto configCenterDto) {
        return configCenterService.getConfigInfo(configCenterDto);
    }

    /**
    * @Author GroundDemo
    * @Description 添加配置
    * @Date 7:55 2024/3/3
    * @Param [configCenterDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/config.add.info")
    public CommonResult<Object> addConfigInfo(@RequestBody ConfigCenterDto configCenterDto) {
        return configCenterService.addConfigInfo(configCenterDto);
    }

    /**
    * @Author GroundDemo
    * @Description 修改配置
    * @Date 7:59 2024/3/3
    * @Param [configCenterDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/config.update.info")
    private CommonResult<Object> updateConfigInfo(@RequestBody ConfigCenterDto configCenterDto) {
        return configCenterService.updateConfigInfo(configCenterDto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除配置
    * @Date 8:03 2024/3/3
    * @Param [configCenterDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/config.delete.info")
    public CommonResult<Object> deleteConfigInfo(@RequestBody ConfigCenterDto configCenterDto) {
        return configCenterService.deleteConfigInfo(configCenterDto);
    }
}
